package web.Order;

import services.OrdersService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/updatePayment")
public class UpdatePayment extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("application/json");
        String payment_state = req.getParameter("payment_state");
        int order_id = Integer.parseInt(req.getParameter("order_id"));
        int num = new OrdersService().updatePayment(payment_state, order_id);
        resp.getWriter().println(num > 0?"秀嘎成功":"修改失败");
    }
}
